home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000115_icon-group-sender _Mon Jun 29 16:24:34 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id QAA25642
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 29 Jun 1998 16:24:34 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA01832; Mon, 29 Jun 1998 16:24:22 -0700
  7. From: Guy Laden <guy@math.tau.ac.il>
  8. Message-Id: <199806291912.WAA25423@orion.math.tau.ac.il>
  9. Subject: Re: Retrieving lists from tables
  10. To: thomaspl@acm.org
  11. Date: Mon, 29 Jun 1998 22:12:36 +0300 (GMT+0300)
  12. Cc: icon-group@optima.CS.Arizona.EDU
  13. In-Reply-To: <35970078.4332DA12@ix.netcom.com> from "Phillip Lee Thomas" at Jun 28, 98 10:48:24 pm
  14. X-Mailer: ELM [version 2.4 PL25]
  15. Mime-Version: 1.0
  16. Content-Type: text/plain; charset=US-ASCII
  17. Content-Transfer-Encoding: 7bit
  18. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  19. Status: RO
  20. Content-Length: 943
  21.  
  22. > I'm working on a project where it would be most convenient to store
  23. > information in a table where the index is a list and the value is a
  24. > record; however, I find it not obvious how to retrieve the data as lists
  25. > are retrieved by their ID number, not their value. Any suggestions?
  26. >
  27. > record ref(part1,part2)
  28. > # Initially...
  29. >         t := table()
  30. >         L := ["house","horse"]
  31. >         t[L] := ref(1,2)
  32. > # Later...
  33. >        L2 := ["house","horse"]
  34. > Now I want to find out if a list with the content of L2 is in table t,
  35. > and if so to augment the value of its part1.
  36.  
  37. I'd be happy to hear of solutions from experienced Icon programmers. My 
  38. solution in a similar case was to create a string out of the list and to
  39. use it as key. I didn't have to handle arbitrary strings in my application
  40. so encoding the list as a string was simple. Perhaps the codeobj module
  41. from the IPL can be used if more generality is needed.
  42.  
  43. Regards,
  44. Guy
  45.